package com.day10.objectarray;

import java.util.Scanner;

public class OneTest {
    public static void main(String[] args) {
        Student[] stus = new Student[5];
        Scanner input = new Scanner(System.in);
//        stus[0] = new Student();
//        stus[0].setStuName("Tom");
//        stus[0].setStuAge(20);
//        stus[0] = new Student("Tom",20);
//        stus[1] = new Student("Jerry",21);
//        stus[2] = new Student("Mary",19);
//        stus[3] = new Student("sanmao",22);
//        stus[4] = new Student("xiaoqiang",23);

        for (int i = 0; i < stus.length; i++) {
            System.out.println("请输入第"+(i+1)+"名学员的名字");
            String name = input.next();
            System.out.println("请输入第"+(i+1)+"名学员的年龄");
            int age = input.nextInt();
            stus[i] = new Student(name,age);
        }

        for (int i = 0; i < stus.length; i++) {
            System.out.println(stus[i].getStuName());
            System.out.println(stus[i].getStuAge());
        }
    }
}
